package com.yami.shop.platform.controller;


import com.yami.shop.common.bean.PageDTO;
import com.yami.shop.common.bean.PageVO;
import com.yami.shop.common.response.ServerResponseEntity;
import com.yami.shop.nft.common.model.NftGasDeploy;
import com.yami.shop.nft.common.service.NftGasDeployService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/nftgas")
@Tag(name = "admin-能量值充值配置信息")
public class NftGasDeployController {

    @Autowired
    private NftGasDeployService nftGasDeployService;

    @GetMapping("/pageGasDeploy")
    @Operation(summary =  "分页能量充值配置列表", description = "分页能量充值配置列表")
    public ServerResponseEntity<PageVO<NftGasDeploy>> pageGasDeploy(PageDTO pageDTO, NftGasDeploy nftGasDeploy) {
        return ServerResponseEntity.success(nftGasDeployService.pageGasDeploy(pageDTO,nftGasDeploy));
    }

    @GetMapping("/getGasListById")
    @Operation(summary =  "获取详情", description = "获取详情")
    public ServerResponseEntity<NftGasDeploy> getGasListById(@RequestParam Integer id) {
        return ServerResponseEntity.success(nftGasDeployService.getGasListById(id));
    }

    @PostMapping("/insert")
    @Operation(summary =  "添加能量配置信息", description = "添加能量配置信息")
    public ServerResponseEntity<Void> insertGasDeploy(@RequestBody NftGasDeploy nftGasDeploy) {
        nftGasDeployService.insertGasDeploy(nftGasDeploy);
        return ServerResponseEntity.success();
    }

    @PostMapping("/update")
    @Operation(summary =  "修改能量配置信息", description = "修改能量配置信息")
    public ServerResponseEntity<Void> getGasListById(@RequestBody NftGasDeploy nftGasDeploy) {
        nftGasDeployService.updateGasDeploy(nftGasDeploy);
        return ServerResponseEntity.success();
    }

    @GetMapping("/delete")
    @Operation(summary =  "删除", description = "删除")
    public ServerResponseEntity<Void> deleteGasDeploy(@RequestParam Integer id) {
        nftGasDeployService.deleteGasDeploy(id);
        return ServerResponseEntity.success();
    }

    @GetMapping("/updatestatus")
    @Operation(summary =  "上下架 1上架 0下架 ", description = "上下架 1上架 0下架 ")
    public ServerResponseEntity<Void> updateStatusGasDeploy(@RequestParam Integer id, @RequestParam Integer status) {
        nftGasDeployService.updateStatusGasDeploy(id,status);
        return ServerResponseEntity.success();
    }

//    @GetMapping("/getGasDeployList")
//    @Operation(summary =  "前端能量充值配置列表", description = "前端能量充值配置列表")
//    public ServerResponseEntity<List<NftGasDeploy>> getGasDeployList() {
//        return ServerResponseEntity.success(nftGasDeployService.getGasDeployList());
//    }
}
